public class Demo1 {

    public static void main(String[] args) throws InterruptedException {

        Object locker1 = new Object();
        Thread t1 = new Thread(() -> {


            try {
                synchronized (locker1) {

                    locker1.wait();
                }
                System.out.println("t1 jieshu ");

            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });

        Thread t2 = new Thread(() -> {

            try {
                synchronized (locker1) {

                    locker1.wait();
                }
                System.out.println("t2 jieshu");

            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });

        t1.start();
        t2.start();
        Thread.sleep(1000);
        synchronized (locker1) {
            locker1.notify();

        }

        Thread.sleep(1000);
        synchronized (locker1) {
            locker1.notify();

        }
    }
}
